<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/3/26 0026
 * Time: 21:32
 */

//$fp = tmpfile();
//var_dump($fp);
//fwrite($fp,'123');
//echo fgets($fp);
//sleep(5);
//fclose($fp); //调用close后自动删除

$fileName = tempnam('./', 'p5pp');
$fp = fopen($fileName, 'w+');

fwrite($fp, 'temporary data');
echo fgets($fp,1024);
fclose($fp);
unlink($fileName);